<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<title>斗地主测试</title>
<script src="/socket.io.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
    $(function(){
        let club, roomid,seatIndex, userId,lastMopai,endAccount;
        let openBtn  = $("#openBtn");
        let dingqueBtn  = $("#dingque");
        let huansanzhangBtn = $("#huansanzhang")
        var socket = io("127.0.0.1:32510"); //通过ip和端口建立一个socket client
        let num = 0;
        // setInterval(function(){
        //     window.location.reload()
        // },1000)
        var hash = window.location.hash, inter;
        socket.on('connect', function(){
            console.log('connect a socket client');
        });
   
        openBtn.click(function(){
            let userId = +$("#userId").val();
            socket.emit("open", {
                userId : userId
            });
        })
        socket.on("open_result", function(data){
            console.log("-----open_result----");
            console.log(data);
        })
        dingqueBtn.click(function(){
            let val = $("#text").val();
            socket.emit("sichuan_dingque", {
                que : +val
            })
        })

        huansanzhangBtn.click(function(){
            let val = $("#text").val();
            val = JSON.parse(val)
            socket.emit("sichuan_huanzhang", {
                pokers : val
            })
        })
        socket.on("game_result", function(data){
            console.log("------game-result-------");
            console.log(data);
        })
        socket.on("request_connect_push", function(data){
            console.log("----------------断线重连--------------");
            console.log(data);
        })
        socket.on("system_error", function(data){
            console.log("--------system_error---------");
            console.log(data);
        });
    })
</script>
</head>
<body>
    <input type="text" name="userId" id="userId" value="138161"/> 
    <input id="openBtn" type="button" value="open"/></br>
    <input id="reconnectBtn" type="button" value="断线重连"></br>
    <input type="text" name="text" id="text" value="[8,8,4]">
    <input id="dingque" type="button" value="定缺"></br>
    <input id="huansanzhang" type="button" value="换三张"></br>
</body>
</html>
